<!-- 公告详情 -->
<template>
  <div class="announcementDetails-page">
    <div class="pck-notice-title">
      <span>最新公告</span>
      <img src="@/assets/icon/back-icon.png" alt="" @click="goBack">
    </div>
    <div class="pck-Exam-content">
      <div class="notice-content">
        <div class="notice-content-title">{{ baseInfo.notice_name }}</div>
        <div class="notice-content-n" v-html="baseInfo.notice_content"></div>
      </div>
    </div>
  </div>
</template>

<script>
import {getNoticeDetail, getNoticeMarkAsRead} from "@/api";
import watermark from "@/utils/watermark";

export default {
  name: "announcementDetails",
  data() {
    return {
      baseInfo: '',
    }
  },
  mounted() {
    let noticeId = this.$route.query.notice_id
    this.getNoticeDetail(noticeId)
    this.getNoticeMarkAsRead(noticeId)
    watermark.set('')
  },
  methods: {
    // 获取公告详情
    getNoticeDetail(id) {
      let params = {
        notice_id: id
      }
      getNoticeDetail(params).then(res => {
        if (res.code == 1) {
          this.baseInfo = res.data || {}
        }
      })
    },
    // 公告已读
    getNoticeMarkAsRead(id) {
      let params = {
        notice_id: id
      }
      getNoticeMarkAsRead(params).then(res => {
        if (res.code == 1) {}
      })
    },
    // 返回公告列表
    goBack() {
      this.$router.push({ path: '/notice' })
    }
  }
}
</script>

<style lang="scss" scoped>
.announcementDetails-page {
  width: 100%;
  height: 100%;
}
</style>
